<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    li {
      list-style: none;
    }
  </style>
</head>

<body>
  <div id="app">
    <p><input type="checkbox" v-model="checkall1"><span @click="step=0"> 人员</span></p>
    <ul v-show="step===0">
      <li v-for="(item,index) in list" :kye="index">
        <input type="checkbox" v-model="item.flag">
        {{item.title}}
      </li>
    </ul>
    <p><input type="checkbox" v-model="checkall2"><span @click="step=1"> 项目</span></p>
    <ul v-show="step===1">
      <li v-for="(item,index) in list1" :kye="index">
        <input type="checkbox" v-model="item.flag">
        {{item.title}}
      </li>
    </ul>
    <p><input type="checkbox" v-model="checkall3"><span @click="step=2"> 机构</span></p>
    <ul v-show="step===2">
      <li v-for="(item,index) in list2" :kye="index">
        <input type="checkbox" v-model="item.flag">
        {{item.title}}
      </li>
    </ul>
  </div>
</body>
<script src="./js/vue.js"></script>
<script>
  new Vue({
    el: "#app",
    data() {
      return {
        step: 0,
        list: [
          {
            title: "01",
            flag: false
          },
          {
            title: "02",
            flag: false
          },
          {
            title: "03",
            flag: false
          }
        ],
        list1: [
          {
            title: "01",
            flag: false
          },
          {
            title: "03",
            flag: false
          },
          {
            title: "03",
            flag: false
          }
        ],
        list2: [
          {
            title: "01",
            flag: false
          },
          {
            title: "03",
            flag: false
          },
          {
            title: "03",
            flag: false
          }
        ]
      }
    },
    computed: {
      checkall1: {
        get() {
          return this.list.every(item => {
            return item.flag == true
          })
        },
        set(v) {
          this.list.forEach(item => {
            item.flag = v
          })
        }
      },
      checkall2: {
        get() {
          return this.list1.every(item => {
            return item.flag == true
          })
        },
        set(v) {
          this.list1.forEach(item => {
            item.flag = v
          })
        }
      },
      checkall3: {
        get() {
          return this.list2.every(item => {
            return item.flag == true
          })
        },
        set(v) {
          this.list2.forEach(item => {
            item.flag = v
          })
        }
      }
    }
  })
</script>

</html>